//
//  LOLSecondDetailEquipCell.m
//  LOLXXbox
//
//  Created by dllo on 16/1/29.
//  Copyright © 2016年 Grasstrio. All rights reserved.
//

#import "LOLSecondDetailEquipCell.h"
#import <Masonry.h>
@implementation LOLSecondDetailEquipCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.descripLabel = [[UILabel alloc] initWithFrame:CGRectZero];
//        self.descripLabel.font = [UIFont systemFontOfSize:15];
        self.descripLabel.numberOfLines = 0;
        [self addSubview:self.descripLabel];
       
    }
    return self;
}

- (void)layoutSubviews{
    [super layoutSubviews];

    self.descripLabel.frame = CGRectMake(10, 0, self.frame.size.width - 20, self.frame.size.height);

}

- (CGFloat )getHeight {
    //    定义一个字典存储label上的字体等信息
    NSDictionary *dic = @{NSFontAttributeName:[UIFont systemFontOfSize:18]};
    //    通过字典计算高度和宽度
    CGRect rect = [self.descripLabel.text boundingRectWithSize:CGSizeMake(self.frame.size.width, CGFLOAT_MAX) options:NSStringDrawingUsesLineFragmentOrigin attributes:dic context:nil];
    self.descripLabel.frame = CGRectMake(_descripLabel.frame.origin.x, _descripLabel.frame.origin.y, _descripLabel.frame.size.width, rect.size.height);
    return rect.size.height;

}


- (void)setDetailModel:(LOLEquipDetailModel *)detailModel{
    _detailModel = detailModel;
    self.descripLabel.text = self.detailModel.descrip;
}



/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
